//Mon May 24 19:47:10 CDT 2010
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;

class WhatsThisChord
{
public:
	string classify(vector<int> chord)
	{
		vector<string> Notes(12);
		Notes[0] = "C";
		Notes[1] = "C#";
		Notes[2] = "D";
		Notes[3] = "D#";
		Notes[4] = "E";
		Notes[5] = "F";
		Notes[6] = "F#";
		Notes[7] = "G";
		Notes[8] = "G#";
		Notes[9] = "A";
		Notes[10] = "A#";
		Notes[11] = "B";
		int Guitar[] =
		{ 4, 9, 2, 7, 11, 4 };
		vector<string> v(6);
		for (int i = 0; i < 6; i++)
		{
			if (chord[i] == -1)
			{
				v[i] = "none";
				continue;
			}
			int idx = (chord[i] + Guitar[i]) % 12;
			v[i] = Notes[idx];
		}
		for (int i = 0; i < 6; i++)
		{
			if (v[i] == "none")
			{
				v.erase(v.begin() + i);
				i--;
			}
		}
		set<string> st(v.begin(), v.end());
		if (st.size() != 3)
			return "";
		return Trans(st);
	}
	string Trans(set<string> v)
	{
		if (v.count("C") == 1 && v.count("E") == 1 && v.count("G") == 1)
			return "C Major";
		if (v.count("C#") == 1 && v.count("F") == 1 && v.count("G#") == 1)
			return "C# Major";
		if (v.count("D") == 1 && v.count("F#") == 1 && v.count("A") == 1)
			return "D Major";
		if (v.count("D#") == 1 && v.count("G") == 1 && v.count("A#") == 1)
			return "D# Major";
		if (v.count("E") == 1 && v.count("G#") == 1 && v.count("B") == 1)
			return "E Major";
		if (v.count("F") == 1 && v.count("A") == 1 && v.count("C") == 1)
			return "F Major";
		if (v.count("F#") == 1 && v.count("A#") == 1 && v.count("C#") == 1)
			return "F# Major";
		if (v.count("G") == 1 && v.count("B") == 1 && v.count("D") == 1)
			return "G Major";
		if (v.count("G#") == 1 && v.count("C") == 1 && v.count("D#") == 1)
			return "G# Major";
		if (v.count("A") == 1 && v.count("C#") == 1 && v.count("E") == 1)
			return "A Major";
		if (v.count("A#") == 1 && v.count("D") == 1 && v.count("F") == 1)
			return "A# Major";
		if (v.count("B") == 1 && v.count("D#") == 1 && v.count("F#") == 1)
			return "B Major";

		if (v.count("C") == 1 && v.count("D#") == 1 && v.count("G") == 1)
			return "C Minor";
		if (v.count("C#") == 1 && v.count("E") == 1 && v.count("G#") == 1)
			return "C# Minor";
		if (v.count("D") == 1 && v.count("F") == 1 && v.count("A") == 1)
			return "D Minor";
		if (v.count("D#") == 1 && v.count("F#") == 1 && v.count("A#") == 1)
			return "D# Minor";
		if (v.count("E") == 1 && v.count("G") == 1 && v.count("B") == 1)
			return "E Minor";
		if (v.count("F") == 1 && v.count("G#") == 1 && v.count("C") == 1)
			return "F Minor";
		if (v.count("F#") == 1 && v.count("A") == 1 && v.count("C#") == 1)
			return "F# Minor";
		if (v.count("G") == 1 && v.count("A#") == 1 && v.count("D") == 1)
			return "G Minor";
		if (v.count("G#") == 1 && v.count("B") == 1 && v.count("D#") == 1)
			return "G# Minor";
		if (v.count("A") == 1 && v.count("C") == 1 && v.count("E") == 1)
			return "A Minor";
		if (v.count("A#") == 1 && v.count("C#") == 1 && v.count("F") == 1)
			return "A# Minor";
		if (v.count("B") == 1 && v.count("D") == 1 && v.count("F#") == 1)
			return "B Minor";
		return "";
	}
};
